# coding=utf-8
from rest_framework.parsers import BaseParser


class TextParser(BaseParser):
    """
    All parsers should extend `BaseParser`, specifying a `media_type`
    attribute, and overriding the `.parse()` method.
    """
    media_type = "text/*"

    def parse(self, stream, media_type=None, parser_context=None):
        return stream.read().decode('utf-8')
